/**
 * KopsoxFramework
 * Copyright (C) 2010 Free Software Foundation, Inc. <http://fsf.org/>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.kopsox.util.xml.data.impl;

import java.util.Collection;
import java.util.Set;

import org.kopsox.util.xml.data.XMLContainerDescriptor;

/**
 * @author Konrad Renner - 23.07.2010
 *
 */
public class XMLContainerDescriptorImpl implements XMLContainerDescriptor {

	private String className;
	private String name;
	private String namespace;
	private Collection<NameNamespaceKey> values;
	private Collection<NamePriorityDescriptor> observers;
	private Collection<NamePriorityDescriptor> validators;
	private Set<String> keyNames;
	private boolean isAutoValidationEnabled;
	private boolean isAutoErrorDelegationEnabled = true;
	
	
	/* (non-Javadoc)
	 * @see org.kopsox.util.xml.data.XMLContainerDescriptor#getValidators()
	 */
	@Override
	public Collection<NamePriorityDescriptor> getValidators() {
		return this.validators;
	}
	
	/**
	 * @param validators the validators to set
	 */
	public void setValidators(Collection<NamePriorityDescriptor> validators) {
		this.validators = validators;
	}

	/* (non-Javadoc)
	 * @see org.kopsox.util.xml.data.XMLContainerDescriptor#isAutoErroDelegationEnabled()
	 */
	@Override
	public boolean isAutoErroDelegationEnabled() {
		return this.isAutoErrorDelegationEnabled;
	}

	/**
	 * @param isAutoErrorDelegationEnabled the isAutoErrorDelegationEnabled to set
	 */
	public void setAutoErrorDelegationEnabled(boolean isAutoErrorDelegationEnabled) {
		this.isAutoErrorDelegationEnabled = isAutoErrorDelegationEnabled;
	}

	/* (non-Javadoc)
	 * @see org.kopsox.util.xml.data.XMLContainerDescriptor#isAutoValidationEnabled()
	 */
	@Override
	public boolean isAutoValidationEnabled() {
		return this.isAutoValidationEnabled;
	}
	
	/**
	 * @param isAutoValidationEnabled the isAutoValidationEnabled to set
	 */
	public void setAutoValidationEnabled(boolean isAutoValidationEnabled) {
		this.isAutoValidationEnabled = isAutoValidationEnabled;
	}

	@Override
	public String getClassName() {
		return this.className;
	}

	@Override
	public String getName() {
		return this.name;
	}

	@Override
	public String getNamespace() {
		return this.namespace;
	}

	@Override
	public Collection<NameNamespaceKey> getValues() {
		return this.values;
	}
	
	/* (non-Javadoc)
	 * @see org.kopsox.util.xml.data.XMLContainerDescriptor#getObservers()
	 */
	@Override
	public Collection<NamePriorityDescriptor> getObservers() {
		return this.observers;
	}
	
	/* (non-Javadoc)
	 * @see org.kopsox.util.xml.data.XMLContainerDescriptor#getKeyNames()
	 */
	@Override
	public Set<String> getKeyNames() {
		return this.keyNames;
	}
	
	/**
	 * @param keyNames the keyNames to set
	 */
	public void setKeyNames(Set<String> keyNames) {
		this.keyNames = keyNames;
	}

	/**
	 * @param observers the observers to set
	 */
	public void setObservers(Collection<NamePriorityDescriptor> observers) {
		this.observers = observers;
	}

	/**
	 * @param className the className to set
	 */
	public void setClassName(String className) {
		this.className = className;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param namespace the namespace to set
	 */
	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}

	/**
	 * @param values the values to set
	 */
	public void setValues(Collection<NameNamespaceKey> values) {
		this.values = values;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("XMLContainerDescriptorImpl[");
		sb.append("name=");
		sb.append(name);
		sb.append(",className=");
		sb.append(className);
		sb.append(",namespace=");
		sb.append(namespace);
		sb.append(",isAutoValidationEnabled=");
		sb.append(isAutoValidationEnabled);
		sb.append(",isAutoErrorDelegationEnabled=");
		sb.append(isAutoErrorDelegationEnabled);
		sb.append(",keyNames=");
		sb.append(keyNames);
		sb.append(",values=");
		sb.append(values);
		sb.append(",observers=");
		sb.append(observers);
		sb.append(",validators=");
		sb.append(validators);
		sb.append("]");
		
		return sb.toString();
	}
}
